package com.szyt.basicframe.exceptioin;

import com.szyt.basicframe.common.ResponseResult;
import com.szyt.basicframe.common.StatusEnum;
import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException{
    private Integer code;
    private String message;

    public BusinessException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public BusinessException(String message) {
        this.code = StatusEnum.INTERNAL_SERVER_ERROR.getCode();
        this.message = message;
    }

    public BusinessException(ResponseResult responseResult) {
        this.code = responseResult.getCode();
        this.message = responseResult.getMsg();
    }

    public BusinessException(ResponseResult responseResult, String message) {
        this.code = responseResult.getCode();
        this.message = message;
    }
}
